<?php


namespace app\api\controller;


use think\Controller;
use think\Db;
use think\Request;

class WorldUser extends Controller
{

  public function register(){
      $requset=Request::instance();
      $data=$requset->param();
      //一条数据查询
      // Db::name("t_user")->where(["name"=> $data["name","password"=>$data["password"]])->find();
      //多条数据查询
      //Db::name("t_user")->select();
      $insert_data=[
          "name" => $data["name"],
          "password"=>$data["password"]
      ];

       // Db::name("t_user")->insert($insert_data);

      $userid=Db::name("t_user")->insertGetId($insert_data);

      $userinfo =Db::name("t_user")->where(["id"=>$userid])->find();

      Db::name("t_user")->where(["id"=>1])->delete();
      $result = [
                   "code"=>200,
                   "msg"=> "注册成功",
                   "data"=>$userinfo
      ];
      return $result;

  }
}